package net.hky365.shop.module.test.controller.app;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll;
import jakarta.validation.Valid;
import net.hky365.shop.framework.common.pojo.CommonResult;
import net.hky365.shop.framework.common.pojo.PageResult;
import net.hky365.shop.framework.common.util.object.BeanUtils;
import net.hky365.shop.module.test.controller.admin.business.vo.business.TestBuinessPageReqVO;
import net.hky365.shop.module.test.dal.dataobject.business.TestBusinessDO;
import net.hky365.shop.module.test.service.business.TestBusinessService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static net.hky365.shop.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - CRM 商机")
@RestController
@RequestMapping("/test/business")
@Validated
public class AppTestBusinessController {

    @Resource
    private TestBusinessService testBusinessService;

    @GetMapping("/aa")
    @Operation(summary = "获列表")
    @PermitAll
    public CommonResult<PageResult<TestBuinessPageReqVO>> getCategoryList(@Valid TestBuinessPageReqVO pageVo) {
        PageResult<TestBusinessDO> busPage = testBusinessService.getBusinessPage(pageVo);
        return success(BeanUtils.toBean(busPage, TestBuinessPageReqVO.class));
    }
}
